﻿using Microsoft.EntityFrameworkCore;

namespace LuckyFish.Ledger.Data;

public class LedgerContext : DbContext
{
    public DbSet<LedgerModel> Ledgers { get; set; }
    public DbSet<CategoryModel> Categorys { get; set; }
    public string DbPath { get; }

    public LedgerContext()
    {
        var folder = Environment.SpecialFolder.LocalApplicationData;
        var path = Environment.GetFolderPath(folder);
        DbPath = Path.Join(path, "blogging.db");
    }

    protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlite($"Data Source={DbPath}");
}